/**
 * @file debug.h
 * @brief Debug macros.
 *
 * 	set debug macros.and control debug print.
 * @author marco
 * @version v1.0
 * @date 2012-08-21
 */

#ifndef __DEBUG_H_
#define __DEBUG_H_

#define DEBUG_MODE 1
#include <stdio.h>
#include <stdlib.h>

#if DEBUG_MODE
	#define DEBUG_NONE 0
	#define DEBUG_WAR 1
	#define DEBUG_ERR 2
	#define DEBUG_INF 3
/** 
 * @brief Level Debug macro .
 *
 * simple print debug.
 * If want to close a debug type.set macro to zero or DEBUG_NONE.
 *
 * @note D(levle, "print string and print type", argvs)
 */
	#define D(level,format, arg...) \
		do { \
			switch (level) { \
				case 1: \
					printf("\33[34m[D][%s][%s][%d]---[" format "]\33[0m \n", __FILE__, __func__, __LINE__, ##arg); \
					break; \
				case 2: \
					printf("\33[31m[D][%s][%s][%d]---[" format "]\33[0m \n", __FILE__, __func__, __LINE__, ##arg); \
					break; \
				case 3: \
					printf("\33[33m[D][%s][%s][%d]---[" format "]\33[0m \n", __FILE__, __func__, __LINE__, ##arg); \
					break; \
				case 0: \
				default: \
					((void)0); \
					break; \
			} \
		}while(0)
	
#else
	#define D(level,format, arg...) ((void)0)
#endif

#if !defined(CV_IMPL)
#define CV_IMPL extern "C"
#endif //CV_IMPL

#endif
